﻿@model BrnMall.Web.StoreAdmin.Models.GroupBuyProductSettingModel

@section header{
    <title>小程序设置-团购活动</title>
    <link type="text/css" rel="stylesheet" href="/admin_store/css/site.css" />
    <link type="text/css" rel="stylesheet" href="/components/webuploader/webuploader.css" />
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>

    <script type="text/javascript" src="/components/webuploader/webuploader.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.unobtrusive.js"></script>

    <script type="text/javascript">
        $(function () {
            var logoUploader = WebUploader.create({
                pick: '.uploadLogoBut',
                auto: true,
                swf: '/components/webuploader/Uploader.swf',
                server: '/storeadmin/tool/upload?operation=uploadstorelogo',
                fileVal: 'upload',
                accept: {
                    title: 'Images',
                    extensions: '@ViewData["allowImgType"]',
                    mimeTypes: '*'
                },
                fileSingleSizeLimit: @ViewData["maxImgSize"]
            });

            logoUploader.on('uploadProgress', function(file, percentage) {
                $(".uploadLogoPreview").html("上传中...");
            });

            logoUploader.on('uploadSuccess', function(file, response) {
                var data = response._raw;
                if (data == "-1")
                    $(".uploadLogoPreview").html('图片不能为空');
                else if (data == "-2")
                    $(".uploadLogoPreview").html('图片类型不允许');
                else if (data == "-3")
                    $(".uploadLogoPreview").html('图片太大');
                else {
                    $(".uploadLogoPreview").html("<img src=\"@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/logo/source/" + data + "\"  />");
                    $("#ShowImg").val(data);
                }
            });

            logoUploader.on('uploadError', function(file) {
                $(".uploadLogoPreview").html("上传失败");
            });

        });
    </script>
    <style type="text/css">
        .uploadBut .cancel, .uploadBut .fileName, .uploadBut .data, .uploadBut .uploadify-progress {display: none;}
    </style>
}

@section body{
    <h1 class="rightH1">
		微信小程序 &gt; 促销活动 &gt; 团购活动 &gt; <span class="rightH1-cur">小程序设置</span>
        <div class="right">
            <a href="@Html.Raw(ViewData["referer"].ToString())" class="menuBT">
                <img src="/admin_store/images/goback.jpg" />返回列表
            </a>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </h1>
    @using (Html.BeginForm())
    {
        @Html.HiddenFor(x=>x.Id)
        @Html.HiddenFor(x=>x.StoreId)
        <div class="addTable">
            <table width="100%">
                <tr>
                    <td style="width:160px;" align="right">是否在首页显示：</td>
                    <td>@Html.CheckBoxFor(x=>x.ShowIndex)</td>
                </tr>
                <tr>
                    <td align="right">首页名称：</td>
                    <td>@Html.TextBoxFor(x => x.Name, new {@class = "input", size = "35"})@Html.ValidationMessageFor(x => x.Name)</td>
                </tr>

                <tr>
                    <td align="right">首页展示图片：</td>
                    <td>
                        <div class="upload">
                            <div class="uploadPreview uploadLogoPreview">
                                @if (!string.IsNullOrEmpty(Model.ShowImg))
                                {
                                    <img src="@WorkContext.ImageCDN/upload/store/@WorkContext.StoreId/logo/source/@Model.ShowImg" />
                                }
                                else
                                {
                                    @:暂无图片
                                }
                            </div>
                            <div class="left">
                                <div class="uploadProgressBar"></div>
                                <div class="uploadBut uploadLogoBut">选择图片,图片尺寸500x70</div>
                            </div>
                            <div class="clear"></div>
                        </div>
                        @Html.TextBoxFor(x => x.ShowImg, new { @class = "hide" })
                        @Html.ValidationMessageFor(x => x.ShowImg)
                        <br />
                    </td>
                </tr>


                <tr>
                    <td align="right">显示区域：</td>
                    <td>
                        @Html.DropDownListFor(x => x.DisplayPosition, ViewData["DisplayPositionSelectItem"] as List<SelectListItem>)@Html.ValidationMessageFor(x => x.DisplayPosition)
                    </td>
                </tr>



                <tr>
                    <td align="right">首页最大商品显示数量：</td>
                    <td>@Html.TextBoxFor(x => x.ShowIndexMax, new { @class = "input", size = "5" })@Html.ValidationMessageFor(x => x.ShowIndexMax)</td>
                </tr>



                <tr>
                    <td align="right">&nbsp;</td>
                    <td>
                        <a href="" class="addBt" id="sumbitBut"><img src="/admin_store/images/submit.jpg" /></a>
                        <script type="text/javascript">
                            $(function() {
                                $("#sumbitBut").click(function() {
                                    $("form:first").submit();
                                    return false;
                                })
                            });
                        </script>
                    </td>
                </tr>
                <tr>
                    <td align="right">&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
            </table>
        </div>
    }
}